package net.mihome.app.ui;


import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;

import net.mihome.app.AppContext;
import net.mihome.app.R;
import net.mihome.app.common.UIHelper;
import net.mihome.app.ui.view.MifuwuBaoxiuListView;
public class MifuwuBaoxiuActivity extends BaseActivity {
	private MifuwuBaoxiuListView mifuwuBaoxiuListView;
	private View baoxiuAddButton;
    private View backView;
	private AppContext appContext;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.mifuwu_baoxiu_main);
		initView();
	}
	/**
	 * 初始化view
	 * */
	public void initView(){
		mifuwuBaoxiuListView=(MifuwuBaoxiuListView) findViewById(R.id.mifuwu_baoxiu_listview);
		mifuwuBaoxiuListView.setOnItemClickListener(new OnItemClickListener() {
			@Override
			public void onItemClick(AdapterView<?> parent, View view,int position, long id) {
				UIHelper.showBaoxiuDetail(view.getContext(),Long.valueOf(id).intValue());
			}
		});
        backView=findViewById(R.id.mifuwu_baoxiu_home);
        backView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
		baoxiuAddButton=findViewById(R.id.baoxiu_add);
		baoxiuAddButton.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View arg0) {
				UIHelper.showBaoxiuPub(arg0.getContext());
			}
		});
		this.appContext=(AppContext)this.getApplicationContext();
//		mifuwuBaoxiuListView.initData();
	}
	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
        mifuwuBaoxiuListView.initData();
	}
	
}
